The SampleInstallerScript sample demonstrates an Installer script which is compatibile with the Installer Engine to install the SampleDriver (USB Module) and the SampleShim (USBShim) into the Extensions folder. If USB 1.4 is present, then an installer post-install action atom is executed to activate the SampleShim file.
SampleInstallerScript Process
-----------------------------
To build this project, you first need to move the project folder to the Examples folder of this SDK. You also need to download a copy of the Installer 1.2.3 SDK from the Apple Developer SDK web site.
<http://developer.apple.com/sdk/index.html>
You then must enter the project preferences for the Installer and the CheckUser function targets and modify the Access Paths to point to the Installer 1.2.3 SDK folder.
To build the SampleInstallerScript, use the provided CodeWarrior project file with CodeWarrior IDE 2.0 or greater. Set the project to SampleInstaller and make the project. CodeWarrior will first compile the CheckUSBUserFn.c code, then Rez the SampleInstall.r file.
Use the FileCrusher application to create the tome file which contains the compressed SampleDriver and SampleShim files. The resulting file is "SampleTome" and will be placed into the SampleDisk folder. The SampleDisk folder represents the name of the volume that would have been used for a CD or floppy disk installation.
Open the MPW Script Commands file, follow the instructions with regards to placing ScriptCheck and the MergeScriptMPWTool tools so that they will be found by MPW.
Execute the commandlines in the in the MPW Script Commands file, which will ScriptCheck the SampleInstallerScript then merge the tome file into the SampleInstallerScript file.
The resulting SampleInstallerScript can be binhex'd then placed onto your ftp or http server for download.
Inside SampleInstallerScript
----------------------------
The SampleInstallerScript works by checking for the presence of a supported Mac OS release and CPU platform. The script then uses a checkRuleFunction as provided in the CheckUSBUserFn.c code to determine whether USB 1.4 is present or not. The presence of USB 1.4 will be used to determine which installer package to install. If USB 1.4 is present, then the installer package will install the driver and shim, then execute a post install action atom to activate the shim. The activation code opens the 'STR ' (1000) for the name of the shim to be passed to the AddShimToDisk function.
Note that there are User Breaks (DebugStr) calls in the ActivateShimAtom.c code. This will require you to have Macsbug installed if you use the code as is.